home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / network / samba / patches / samba-1.020 / samba-1
Text File  |  1995-12-05  |  37KB  |  1,316 lines

  1. diff -u -r --new-file last-version/README samba-1.9.15p6/README
  2. --- last-version/README    Sat Nov 11 13:08:13 1995
  3. +++ samba-1.9.15p6/README    Mon Dec  4 00:35:44 1995
  4. @@ -49,7 +49,7 @@
  5.  something else.
  6.  
  7.  Andrew Tridgell
  8. -Andrew.Tridgell@anu.edu.au
  9. +Email: samba-bugs@anu.edu.au
  10.  
  11.  3 Ballow Crescent
  12.  Macgregor, A.C.T.
  13. diff -u -r --new-file last-version/docs/security_level.txt samba-1.9.15p6/docs/security_level.txt
  14. --- last-version/docs/security_level.txt    Thu Jan  1 10:00:00 1970
  15. +++ samba-1.9.15p6/docs/security_level.txt    Tue Dec  5 14:52:56 1995
  16. @@ -0,0 +1,78 @@
  17. +Description of SMB security levels.
  18. +----------------------------------
  19. +
  20. +
  21. +A SMB server tells the client at startup what "security level" it is
  22. +running. There are two options "share level" and "user level". Which
  23. +of these two the client receives affects the way the client then tries
  24. +to authenticate itself. It does not directly affect (to any great
  25. +extent) the way the Samba server does security. I know this is
  26. +strange, but it fits in with the client/server aproach of SMB. In SMB
  27. +everything is initiated and controlled by the client, and the server
  28. +can only tell the client what is available and whether an action is
  29. +allowed. 
  30. +
  31. +I'll describe user level security first, as its simpler. In user level
  32. +security the client will send a "session setup" command directly after
  33. +the protocol negotiation. This contains a username and password. The
  34. +server can either accept or reject that username/password
  35. +combination. Note that at this stage the server has no idea what
  36. +share the client will eventually try to connect to, so it can't base
  37. +the "accept/reject" on anything other than:
  38. +
  39. +- the username/password
  40. +- the machine that the client is coming from
  41. +
  42. +If the server accepts the username/password then the client expects to
  43. +be able to mount any share (using a "tree connection") without
  44. +specifying a password. It expects that all access rights will be as
  45. +the username/password specified in the "session setup". 
  46. +
  47. +It is also possible for a client to send multiple "sesion setup"
  48. +requests. When the server responds it gives the client a "uid" to use
  49. +as an authentication tag for that username/password. The client can
  50. +maintain multiple authentication contexts in this way (WinDD is an
  51. +example of an application that does this)
  52. +
  53. +
  54. +Ok, now for share level security. In share level security (the default
  55. +with samba) the client authenticates itself separately for each
  56. +share. It will send a password along with each "tree connection"
  57. +(share mount). It does not explicitly send a username with this
  58. +operation. The client is expecting a password to be assciated with
  59. +each share, independent of the user. This means that samba has to work
  60. +out what username the client probably wants to use. It is never
  61. +explicitly sent the username. A "real" SMB server like NT actually
  62. +associates passwords directly with shares in share level security, but
  63. +samba always uses the unix authentication scheme where it is a
  64. +username/password that is authenticated, not a "share/password".
  65. +
  66. +Many clients send a "session setup" even if the server is in share
  67. +level security. They normally send a valid username but no
  68. +password. Samba records this username is a list of "possible
  69. +usernames". When the client then does a "tree connection" it also adds
  70. +to this list the name of the share they try to connect to (useful for
  71. +home directories) and any users listed in the "user =" smb.conf
  72. +line. The password is then checked in turn against these "possible
  73. +usernames". If a match is found then the client is authenticated as
  74. +that user.
  75. +
  76. +Finally "server level" security. In server level security the samba
  77. +server reports to the client that it is in user level security. The
  78. +client then does a "session setup" as described earlier. The samba
  79. +server takes the username/password that the client sends and attempts
  80. +to login to the "password server" by sending exactly the same
  81. +username/password that it got from the client. If that server is in
  82. +user level security and accepts the password then samba accepts the
  83. +clients connection. This allows the samba server to use another SMB
  84. +server as the "password server". 
  85. +
  86. +You should also note that at the very start of all this, where the
  87. +server tells the client what security level it is in, it also tells
  88. +the client if it supports encryption. If it does then it supplies the
  89. +client with a random "cryptkey". The client will then send all
  90. +passwords in encrypted form. You have to compile samba with encryption
  91. +enabled to support this feature, and you have to maintain a separate
  92. +smbpasswd file with SMB style encrypted passwords. It is
  93. +cryptographically impossible to translate from unix style encryption
  94. +to SMB style encryption.
  95. diff -u -r --new-file last-version/source/Makefile samba-1.9.15p6/source/Makefile
  96. --- last-version/source/Makefile    Sun Dec  3 18:57:00 1995
  97. +++ samba-1.9.15p6/source/Makefile    Mon Dec  4 10:50:41 1995
  98. @@ -412,6 +412,12 @@
  99.  # FLAGSM = -DSOLARIS -DSHADOW_PWD -DBSD_COMP
  100.  # LIBSM = -lsocket -lnsl
  101.  
  102. +# This is for QNX 4.22
  103. +# Contributed by eldo@invisa.satlink.net (Eldo Loguzzo)
  104. +# FLAGSM = -DQNX -DGUEST_SESSSETUP=1
  105. +# LIBSM =
  106. +
  107. +
  108.  
  109.  ######################################################################
  110.  # DON'T EDIT BELOW THIS LINE
  111. diff -u -r --new-file last-version/source/change-log samba-1.9.15p6/source/change-log
  112. --- last-version/source/change-log    Sun Dec  3 21:56:45 1995
  113. +++ samba-1.9.15p6/source/change-log    Tue Dec  5 15:52:16 1995
  114. @@ -1721,11 +1721,23 @@
  115.      - partially documented the "character set" option
  116.      - changed default for MAXDIR to 64
  117.      - changed default DPTR idle time to 120
  118. +    - released p5
  119. +    - QNX patches from eldo@invisa.satlink.net (Eldo Loguzzo)    
  120. +    - made nmbd use the "max log size" option and changed log handling
  121. +    code a bit
  122. +    - sunos patches, remote protocol (%R) addition and arch detection
  123. +    changes to stop compiler warning from Timothy Hunt <tim@fsg.com>
  124. +    - fixed become_user() bug that led to incorrect permissions in
  125. +    some situations.
  126.      
  127.      
  128.  ==========
  129.  todo:
  130.  
  131. +nmbd needs to keep browse list uptodate by talking to the master if it loses
  132. +an election as others may still think its a valid backup and use it to get
  133. +lists. 
  134. +    
  135.  leftover lock files can end up belonging to non-smbd processes after a reboot.
  136.      
  137.  hosts allow in nmbd
  138. @@ -1775,6 +1787,8 @@
  139.  reverse mangled maps, so (*.html *.htm) works for new files.
  140.  
  141.  install problems with w95. could be some sort of race?
  142. +
  143. +more efficient Files[] structure to handle thousands of open files
  144.      
  145.  lpd stuff:
  146.       Tony Aiuto (tony@ics.com)
  147. diff -u -r --new-file last-version/source/client.c samba-1.9.15p6/source/client.c
  148. --- last-version/source/client.c    Sun Dec  3 16:41:44 1995
  149. +++ samba-1.9.15p6/source/client.c    Mon Dec  4 11:47:53 1995
  150. @@ -1350,8 +1350,6 @@
  151.            exit(1);
  152.          }
  153.          
  154. -        log_in(inbuf,4);
  155. -        
  156.          /* Even though this is not an smb message, smb_len
  157.             returns the generic length of an smb message */
  158.          datalen = smb_len(inbuf);
  159. @@ -1376,8 +1374,6 @@
  160.            DEBUG(0,("Failed to read data in readbraw\n"));
  161.            exit(1);
  162.          }
  163. -        log_in(inbuf,datalen);
  164. -
  165.          dataptr = inbuf;
  166.        }
  167.        break;
  168. @@ -4197,18 +4193,6 @@
  169.  
  170.  
  171.    DEBUG(3,("%s client started (version %s)\n",timestring(),VERSION));
  172. -
  173. -  if (DEBUGLEVEL > 100)
  174. -    {
  175. -      extern FILE *login,*logout;
  176. -      pstring fname;
  177. -      sprintf(fname,"%s.in",debugf);
  178. -      login = fopen(fname,"w"); 
  179. -      if (login) chmod(fname,0600);
  180. -      sprintf(fname,"%s.out",debugf);
  181. -      logout = fopen(fname,"w");
  182. -      if (logout) chmod(fname,0600);
  183. -    }
  184.  
  185.    get_myname(*myname?NULL:myname,&myip);  
  186.    strupper(myname);
  187. diff -u -r --new-file last-version/source/clitar.c samba-1.9.15p6/source/clitar.c
  188. --- last-version/source/clitar.c    Thu Nov 30 09:35:34 1995
  189. +++ samba-1.9.15p6/source/clitar.c    Mon Dec  4 11:47:51 1995
  190. @@ -601,8 +601,6 @@
  191.            exit(1);
  192.          }
  193.          
  194. -        log_in(inbuf,4);
  195. -        
  196.          /* Even though this is not an smb message, smb_len
  197.             returns the generic length of an smb message */
  198.          datalen = smb_len(inbuf);
  199. @@ -627,8 +625,6 @@
  200.            DEBUG(0,("Failed to read data in readbraw\n"));
  201.            exit(1);
  202.          }
  203. -        log_in(inbuf,datalen);
  204. -        
  205.          dataptr = inbuf;
  206.            }
  207.            break;
  208. diff -u -r --new-file last-version/source/getsmbpass.c samba-1.9.15p6/source/getsmbpass.c
  209. --- last-version/source/getsmbpass.c    Wed Nov 22 21:55:33 1995
  210. +++ samba-1.9.15p6/source/getsmbpass.c    Tue Dec  5 13:08:45 1995
  211. @@ -52,7 +52,8 @@
  212.      return ioctl(fd, TCSETS, t);
  213.  }
  214.  
  215. -#elif BSD_TERMIO
  216. +#else /* SYSV_TERMIO */
  217. +#ifdef BSD_TERMIO
  218.  
  219.  /* BSD TERMIO HANDLING */
  220.  
  221. @@ -66,6 +67,10 @@
  222.  #define TCSAFLUSH 1
  223.  #endif
  224.  
  225. +#ifndef TCSANOW
  226. +#define TCSANOW 0
  227. +#endif
  228. +
  229.  int tcgetattr(int fd, struct sgttyb *t)
  230.  {
  231.      return ioctl(fd, TIOCGETP, (char *)t);
  232. @@ -76,7 +81,7 @@
  233.      return ioctl(fd, TIOCSETP, (char *)t);
  234.  }
  235.  
  236. -#else
  237. +#else /* BSD_TERMIO */
  238.  
  239.  /* POSIX TERMIO HANDLING */
  240.  #define ECHO_IS_ON(t) ((t).c_lflag & ECHO)
  241. @@ -84,7 +89,8 @@
  242.  #define TURN_ECHO_ON(t) ((t).c_lflag |= ECHO)
  243.  
  244.  static struct termios t;
  245. -#endif
  246. +#endif /* BSD_TERMIO */
  247. +#endif /* SYSV_TERMIO */
  248.  
  249.  char *
  250.  getsmbpass(char *prompt)     
  251. diff -u -r --new-file last-version/source/includes.h samba-1.9.15p6/source/includes.h
  252. --- last-version/source/includes.h    Thu Nov 23 11:03:29 1995
  253. +++ samba-1.9.15p6/source/includes.h    Tue Dec  5 13:08:46 1995
  254. @@ -80,6 +80,15 @@
  255.  #define NO_RESOURCEH
  256.  #endif
  257.  
  258. +#ifdef QNX
  259. +#define NO_RESOURCEH
  260. +#define NO_SYSMOUNTH
  261. +#define USE_MMAP 1
  262. +#ifdef __386__
  263. +   #define __i386__
  264. +#endif
  265. +#endif
  266. +
  267.  #if (defined(SHADOW_PWD)||defined(OSF1_ENH_SEC)||defined(SecureWare)||defined(PWDAUTH))
  268.  #define PASSWORD_LENGTH 16
  269.  #endif
  270. @@ -221,7 +230,7 @@
  271.  #include <errno.h>
  272.  #include <sys/wait.h>
  273.  #include <signal.h>
  274. -#include <termios.h>
  275. +/* #include <termios.h> */
  276.  #ifdef sun386
  277.  #define NO_STRFTIME
  278.  #define NO_UTIMBUF
  279. @@ -232,6 +241,7 @@
  280.  #define NO_STRERROR
  281.  #endif
  282.  #define REPLACE_GETPASS
  283. +#define BSD_TERMIO
  284.  #endif
  285.  
  286.  
  287. @@ -759,6 +769,24 @@
  288.  #define STATFS4
  289.  #define        USE_GETCWD
  290.  #endif
  291. +
  292. +#ifdef QNX
  293. +#define STATFS4
  294. +#include <sys/statfs.h>
  295. +#include <sys/select.h>
  296. +#include <signal.h>
  297. +#include <sys/dir.h>
  298. +#define SIGNAL_CAST (void (*)())
  299. +#define USE_WAITPID
  300. +#define NO_INITGROUPS
  301. +#define NO_SETGROUPS
  302. +#define HAVE_TIMEZONE
  303. +#define USE_GETCWD
  304. +#define USE_SETSID
  305. +#define HAVE_FCNTL_LOCK 1
  306. +#define DEFAULT_PRINTING PRINT_QNX
  307. +#endif
  308. +
  309.  
  310.  
  311.  /*******************************************************************
  312. diff -u -r --new-file last-version/source/loadparm.c samba-1.9.15p6/source/loadparm.c
  313. --- last-version/source/loadparm.c    Sun Dec  3 00:17:01 1995
  314. +++ samba-1.9.15p6/source/loadparm.c    Tue Dec  5 15:05:25 1995
  315. @@ -597,6 +597,14 @@
  316.        string_initial(&sDefault.szLprmcommand,"cancel %p-%j");
  317.        string_initial(&sDefault.szPrintcommand,"lp -c -d%p %s; rm %s");
  318.        break;
  319. +
  320. +    case PRINT_QNX:
  321. +      string_initial(&sDefault.szLpqcommand,"lpq -P%p");
  322. +      string_initial(&sDefault.szLprmcommand,"lprm -P%p %j");
  323. +      string_initial(&sDefault.szPrintcommand,"lp -r -P%p %s");
  324. +      break;
  325. +
  326. +      
  327.      }
  328.  }
  329.  
  330. @@ -1266,6 +1274,8 @@
  331.      *val = PRINT_HPUX;
  332.    else if (strequal(pszParmValue,"bsd"))
  333.      *val = PRINT_BSD;
  334. +  else if (strequal(pszParmValue,"qnx"))
  335. +    *val = PRINT_QNX;
  336.    return(True);
  337.  }
  338.  
  339. @@ -1298,7 +1308,7 @@
  340.    if (file_exist(fname,NULL))
  341.      return(pm_process(fname, do_section, do_parameter));      
  342.  
  343. -  DEBUG(1,("Can't find include file %s\n",fname));
  344. +  DEBUG(2,("Can't find include file %s\n",fname));
  345.  
  346.    return(False);
  347.  }
  348. diff -u -r --new-file last-version/source/nameserv.c samba-1.9.15p6/source/nameserv.c
  349. --- last-version/source/nameserv.c    Sat Dec  2 19:28:23 1995
  350. +++ samba-1.9.15p6/source/nameserv.c    Mon Dec  4 11:48:17 1995
  351. @@ -2080,12 +2080,12 @@
  352.  
  353.    TimeInit();
  354.  
  355. +  strcpy(debugf,NMBLOGFILE);
  356. +
  357.    setup_logging(argv[0],False);
  358.  
  359.    charset_initialise();
  360.  
  361. -  strcpy(debugf,NMBLOGFILE);
  362. -
  363.  #ifdef LMHOSTSFILE
  364.    strcpy(host_file,LMHOSTSFILE);
  365.  #endif
  366. @@ -2159,17 +2159,6 @@
  367.        usage(argv[0]);
  368.      break;
  369.        }
  370. -
  371. -  
  372. -  if (DEBUGLEVEL > 10)
  373. -    {
  374. -      extern FILE *login,*logout;
  375. -      pstring fname;
  376. -      sprintf(fname,"%s.in",debugf);
  377. -      login = fopen(fname,"w"); 
  378. -      sprintf(fname,"%s.out",debugf);
  379. -      logout = fopen(fname,"w");
  380. -    }
  381.    
  382.    DEBUG(1,("%s netbios nameserver version %s started\n",timestring(),VERSION));
  383.    DEBUG(1,("Copyright Andrew Tridgell 1994\n"));
  384. diff -u -r --new-file last-version/source/nmblib.c samba-1.9.15p6/source/nmblib.c
  385. --- last-version/source/nmblib.c    Wed Nov 22 18:42:17 1995
  386. +++ samba-1.9.15p6/source/nmblib.c    Mon Dec  4 16:51:42 1995
  387. @@ -629,10 +629,10 @@
  388.        p += 16;
  389.  
  390.        if (p[0] & 0x80) strcat(flags,"<GROUP> ");
  391. -      if (p[0] & 0x60 == 0) strcat(flags,"B ");
  392. -      if (p[0] & 0x60 == 1) strcat(flags,"P ");
  393. -      if (p[0] & 0x60 == 2) strcat(flags,"M ");
  394. -      if (p[0] & 0x60 == 3) strcat(flags,"_ ");
  395. +      if ((p[0] & 0x60) == 0) strcat(flags,"B ");
  396. +      if ((p[0] & 0x60) == 1) strcat(flags,"P ");
  397. +      if ((p[0] & 0x60) == 2) strcat(flags,"M ");
  398. +      if ((p[0] & 0x60) == 3) strcat(flags,"_ ");
  399.        if (p[0] & 0x10) strcat(flags,"<DEREGISTERING> ");
  400.        if (p[0] & 0x08) strcat(flags,"<CONFLICT> ");
  401.        if (p[0] & 0x04) strcat(flags,"<ACTIVE> ");
  402. diff -u -r --new-file last-version/source/printing.c samba-1.9.15p6/source/printing.c
  403. --- last-version/source/printing.c    Sun Dec  3 19:28:08 1995
  404. +++ samba-1.9.15p6/source/printing.c    Mon Dec  4 10:49:03 1995
  405. @@ -494,7 +494,69 @@
  406.    return(True);
  407.  }
  408.  
  409. +/****************************************************************************
  410. +parse a lpq line
  411. +
  412. +here is an example of lpq output under qnx
  413. +Spooler: /qnx/spooler, on node 1
  414. +Printer: txt        (ready) 
  415. +0000:     root    [job #1    ]   active 1146 bytes    /etc/profile
  416. +0001:     root    [job #2    ]    ready 2378 bytes    /etc/install
  417. +0002:     root    [job #3    ]    ready 1146 bytes    -- standard input --
  418. +****************************************************************************/
  419. +static BOOL parse_lpq_qnx(char *line,print_queue_struct *buf,BOOL first)
  420. +{
  421. +  string tok[7];
  422. +  int count=0;
  423. +
  424. +  DEBUG(0,("antes [%s]\n", line));
  425. +
  426. +  /* handle the case of "-- standard input --" as a filename */
  427. +  string_sub(line,"standard input","STDIN");
  428. +  DEBUG(0,("despues [%s]\n", line));
  429. +  string_sub(line,"-- ","\"");
  430. +  string_sub(line," --","\"");
  431. +  DEBUG(0,("despues 1 [%s]\n", line));
  432. +
  433. +  string_sub(line,"[job #","");
  434. +  string_sub(line,"]","");
  435. +  DEBUG(0,("despues 2 [%s]\n", line));
  436. +
  437. +  
  438. +  
  439. +  for (count=0; count<7 && next_token(&line,tok[count],NULL); count++) ;
  440.  
  441. +  /* we must get 7 tokens */
  442. +  if (count < 7)
  443. +    return(False);
  444. +
  445. +  /* the 3rd and 5th columns must be integer */
  446. +  if (!isdigit(*tok[2]) || !isdigit(*tok[4])) return(False);
  447. +
  448. +  /* only take the last part of the filename */
  449. +  {
  450. +    string tmp;
  451. +    char *p = strrchr(tok[6],'/');
  452. +    if (p)
  453. +      {
  454. +    strcpy(tmp,p+1);
  455. +    strcpy(tok[6],tmp);
  456. +      }
  457. +  }
  458. +    
  459. +
  460. +  buf->job = atoi(tok[2]);
  461. +  buf->size = atoi(tok[4]);
  462. +  buf->status = strequal(tok[3],"active")?LPQ_PRINTING:LPQ_QUEUED;
  463. +  buf->priority = 0;
  464. +  buf->time = time(NULL);
  465. +  StrnCpy(buf->user,tok[1],sizeof(buf->user)-1);
  466. +  StrnCpy(buf->file,tok[6],sizeof(buf->file)-1);
  467. +  return(True);
  468. +}
  469. +
  470. +
  471. +
  472.  char *stat0_strings[] = { "enabled", "online", "idle", "no entries", "free", "ready", NULL };
  473.  char *stat1_strings[] = { "offline", "disabled", "down", "off", "waiting", "no daemon", NULL };
  474.  char *stat2_strings[] = { "jam", "paper", "error", "responding", "not accepting", "not running", "turned off", NULL };
  475. @@ -518,6 +580,9 @@
  476.        break;
  477.      case PRINT_HPUX:
  478.        ret = parse_lpq_hpux(line,buf,first);
  479. +      break;
  480. +    case PRINT_QNX:
  481. +      ret = parse_lpq_qnx(line,buf,first);
  482.        break;
  483.      default:
  484.        ret = parse_lpq_bsd(line,buf,first);
  485. diff -u -r --new-file last-version/source/server.c samba-1.9.15p6/source/server.c
  486. --- last-version/source/server.c    Sun Dec  3 19:26:05 1995
  487. +++ samba-1.9.15p6/source/server.c    Tue Dec  5 15:57:11 1995
  488. @@ -30,8 +30,6 @@
  489.  extern pstring debugf;
  490.  extern pstring sesssetup_user;
  491.  
  492. -BOOL append_log = True;
  493. -
  494.  char *InBuffer = NULL;
  495.  char *OutBuffer = NULL;
  496.  char *last_inbuf = NULL;
  497. @@ -42,7 +40,9 @@
  498.  BOOL share_mode_pending = False;
  499.  
  500.  /* have I done a become_user? */
  501. -int done_become_user = -1;
  502. +static struct {
  503. +  int cnum, uid;
  504. +} last_user;
  505.  
  506.  /* the last message the was processed */
  507.  int last_message = -1;
  508. @@ -1343,13 +1343,8 @@
  509.      }
  510.    }
  511.  
  512. -  if (flags == O_RDONLY) {
  513. -    /* when opening read only don't allow create and trunc bits */
  514. -    flags2 &= ~(O_TRUNC | O_CREAT);
  515. -  }
  516. -
  517. -
  518. -  DEBUG(4,("calling open_file with flags=0x%X flags2=0x%X\n",flags,flags2));
  519. +  DEBUG(4,("calling open_file with flags=0x%X flags2=0x%X mode=0%o\n",
  520. +       flags,flags2,mode));
  521.  
  522.    open_file(fnum,cnum,fname,flags|(flags2&~(O_TRUNC)),mode);
  523.    if (!Files[fnum].open && flags==O_RDWR && errno!=ENOENT && fcbopen) {
  524. @@ -1387,7 +1382,7 @@
  525.      if (!share_pid)
  526.        share_mode_pending = True;
  527.  
  528. -    if (flags2&O_TRUNC) 
  529. +    if ((flags2&O_TRUNC) && file_existed)
  530.        truncate_unless_locked(fnum,cnum);
  531.    }
  532.  }
  533. @@ -1633,7 +1628,7 @@
  534.    if (!ret)
  535.      DEBUG(1,("Failed to become guest. Invalid guest account?\n"));
  536.  
  537. -  done_become_user = -2;
  538. +  last_user.cnum = -2;
  539.  
  540.    return(ret);
  541.  }
  542. @@ -1664,11 +1659,19 @@
  543.  ****************************************************************************/
  544.  BOOL become_user(int cnum, int uid)
  545.  {
  546. +  int new_umask;
  547.    user_struct *vuser;
  548.    int snum,gid;
  549.    int ngroups;
  550.    gid_t *groups;
  551.  
  552. +  if (last_user.cnum == cnum && last_user.uid == uid) {
  553. +    DEBUG(4,("Skipping become_user - already user\n"));
  554. +    return(True);
  555. +  }
  556. +
  557. +  unbecome_user();
  558. +
  559.    if (!OPEN_CNUM(cnum)) {
  560.      DEBUG(2,("Connection %d not open\n",cnum));
  561.      return(False);
  562. @@ -1698,14 +1701,6 @@
  563.      ngroups = vuser->user_ngroups;
  564.    }
  565.  
  566. -  if (done_become_user == uid) {
  567. -    DEBUG(4,("Skipping become_user - already user\n"));
  568. -    return(True);
  569. -  }
  570. -
  571. -  if (done_become_user != -1)
  572. -    unbecome_user();
  573. -
  574.    if (initial_uid == 0)
  575.      {
  576.        if (!become_gid(gid)) return(False);
  577. @@ -1723,12 +1718,14 @@
  578.      return(False);
  579.      }
  580.  
  581. -  old_umask = umask(0777 & ~(CREATE_MODE(cnum)));
  582. +  new_umask = 0777 & ~CREATE_MODE(cnum);
  583. +  old_umask = umask(new_umask);
  584.  
  585. -  done_become_user = uid;
  586. +  last_user.cnum = cnum;
  587. +  last_user.uid = uid;
  588.    
  589. -  DEBUG(5,("become_user uid=(%d,%d) gid=(%d,%d)\n",
  590. -       getuid(),geteuid(),getgid(),getegid()));
  591. +  DEBUG(5,("become_user uid=(%d,%d) gid=(%d,%d) new_umask=0%o\n",
  592. +       getuid(),geteuid(),getgid(),getegid(),new_umask));
  593.    
  594.    return(True);
  595.  }
  596. @@ -1738,11 +1735,11 @@
  597.  ****************************************************************************/
  598.  BOOL unbecome_user(void )
  599.  {
  600. -  ChDir(OriginalDir);
  601. -
  602. -  if (done_become_user == -1)
  603. +  if (last_user.cnum == -1)
  604.      return(False);
  605.  
  606. +  ChDir(OriginalDir);
  607. +
  608.    umask(old_umask);
  609.  
  610.    if (initial_uid == 0)
  611. @@ -1781,7 +1778,7 @@
  612.    DEBUG(5,("unbecome_user now uid=(%d,%d) gid=(%d,%d)\n",
  613.      getuid(),geteuid(),getgid(),getegid()));
  614.  
  615. -  done_become_user = -1;
  616. +  last_user.cnum = -1;
  617.  
  618.    return(True);
  619.  }
  620. @@ -2115,103 +2112,6 @@
  621.    return True;
  622.  }
  623.  
  624. -/****************************************************************************
  625. -reopen the log files
  626. -****************************************************************************/
  627. -void reopen_logs(void)
  628. -{
  629. -  extern FILE *dbf;
  630. -  extern FILE *login,*logout;
  631. -  pstring fname;
  632. -  if (DEBUGLEVEL > 100)
  633. -    {
  634. -      if (!login)
  635. -    {
  636. -      sprintf(fname,"%s.in",debugf);
  637. -      login = fopen(fname,"w"); 
  638. -      if (login) chmod(fname,0600);
  639. -    }
  640. -      if (!logout)
  641. -    {
  642. -      sprintf(fname,"%s.out",debugf);
  643. -      logout = fopen(fname,"w");
  644. -      if (logout) chmod(fname,0600);
  645. -    }
  646. -    }
  647. -  else
  648. -    {
  649. -      if (login) 
  650. -    {
  651. -      fclose(login);
  652. -      login = NULL;
  653. -    }
  654. -      if (logout) 
  655. -    {
  656. -      fclose(logout);
  657. -      logout = NULL;
  658. -    }
  659. -    }
  660. -
  661. -  
  662. -  if (DEBUGLEVEL > 0)
  663. -    {
  664. -      strcpy(fname,debugf);
  665. -      if (lp_loaded() && (*lp_logfile()))
  666. -    strcpy(fname,lp_logfile());
  667. -
  668. -      if (!strcsequal(fname,debugf) || !dbf || !file_exist(debugf,NULL))
  669. -    {
  670. -      strcpy(debugf,fname);
  671. -      if (dbf) fclose(dbf);
  672. -      if (append_log)
  673. -        dbf = fopen(debugf,"a");
  674. -      else
  675. -        dbf = fopen(debugf,"w");
  676. -      if (dbf) setbuf(dbf,NULL);
  677. -    }
  678. -    }
  679. -  else
  680. -    {
  681. -      if (dbf)
  682. -    {
  683. -      fclose(dbf);
  684. -      dbf = NULL;
  685. -    }
  686. -    }
  687. -}
  688. -
  689. -
  690. -
  691. -/****************************************************************************
  692. -check the size of the log file
  693. -****************************************************************************/
  694. -static void check_log_size(void)
  695. -{
  696. -  extern FILE *dbf;
  697. -  int maxlog = lp_max_log_size() * 1024;
  698. -
  699. -  if (dbf && maxlog > 0)
  700. -    {
  701. -      struct stat st;
  702. -
  703. -      if (fstat(fileno(dbf),&st) != 0) return;
  704. -
  705. -      if (st.st_size > maxlog)
  706. -    {
  707. -      fclose(dbf); dbf = NULL;
  708. -      reopen_logs();
  709. -      if (dbf && file_size(debugf) > maxlog)
  710. -        {
  711. -          pstring name;
  712. -          fclose(dbf); dbf = NULL;
  713. -          sprintf(name,"%s.old",debugf);
  714. -          sys_rename(debugf,name);
  715. -          reopen_logs();
  716. -        }
  717. -    }
  718. -    }
  719. -}
  720. -
  721.  
  722.  /****************************************************************************
  723.  check if a snum is in use
  724. @@ -2632,7 +2532,6 @@
  725.    /* we've finished with the sensitive stuff */
  726.    unbecome_user();
  727.  
  728. -
  729.    {
  730.      extern struct from_host Client_info;
  731.      DEBUG(IS_IPC(cnum)?3:1,("%s %s (%s) connect to service %s as user %s (uid=%d,gid=%d) (pid %d)\n",
  732. @@ -2697,26 +2596,6 @@
  733.  }
  734.  
  735.  
  736. -/* List of supported protocols, most desired first */
  737. -struct {
  738. -  char *proto_name;
  739. -  int (*proto_reply_fn)(char *);
  740. -  int protocol_level;
  741. -} supported_protocols[] = {
  742. -  {"NT LANMAN 1.0", reply_nt1 , PROTOCOL_NT1},
  743. -  {"NT LM 0.12", reply_nt1 , PROTOCOL_NT1},
  744. -  {"LM1.2X002", reply_lanman2 , PROTOCOL_LANMAN2},
  745. -  {"Samba", reply_lanman2 , PROTOCOL_LANMAN2},
  746. -  {"DOS LM1.2X002", reply_lanman2 , PROTOCOL_LANMAN2},
  747. -  {"LANMAN1.0", reply_lanman1 , PROTOCOL_LANMAN1},
  748. -  {"MICROSOFT NETWORKS 3.0", reply_lanman1 , PROTOCOL_LANMAN1},
  749. -  {"MICROSOFT NETWORKS 1.03",reply_coreplus,PROTOCOL_COREPLUS},/* core+ protocol */
  750. -  {"PC NETWORK PROGRAM 1.0", reply_corep, PROTOCOL_CORE}, /* core protocol */
  751. -  {NULL,NULL},
  752. -};
  753. -
  754. -
  755. -
  756.  /****************************************************************************
  757.  reply for the core protocol
  758.  ****************************************************************************/
  759. @@ -2915,6 +2794,55 @@
  760.  protocol [LANMAN2.1]
  761.  */
  762.  
  763. +/*
  764. +  * Modified to recognize the architecture of the remote machine better.
  765. +  *
  766. +  * This appears to be the matrix of which protocol is used by which
  767. +  * MS product.
  768. +       Protocol                       WfWg    Win95   WinNT  OS/2
  769. +       PC NETWORK PROGRAM 1.0          1       1       1      1
  770. +       XENIX CORE                                      2      2
  771. +       MICROSOFT NETWORKS 3.0          2       2       
  772. +       DOS LM1.2X002                   3       3       
  773. +       MICROSOFT NETWORKS 1.03                         3
  774. +       DOS LANMAN2.1                   4       4       
  775. +       LANMAN1.0                                       4      3
  776. +       Windows for Workgroups 3.1a     5       5       5
  777. +       LM1.2X002                                       6      4
  778. +       LANMAN2.1                                       7      5
  779. +       NT LM 0.12                              6       8
  780. +  *
  781. +  *  tim@fsg.com 09/29/95
  782. +  */
  783. +  
  784. +#define ARCH_WFWG     0x3      /* This is a fudge because WfWg is like Win95 */
  785. +#define ARCH_WIN95    0x2
  786. +#define    ARCH_OS2      0xC      /* Again OS/2 is like NT */
  787. +#define ARCH_WINNT    0x8
  788. +#define ARCH_SAMBA    0x10
  789. +#define ARCH_ALL      0x1F
  790. +/* List of supported protocols, most desired first */
  791. +struct {
  792. +  char *proto_name;
  793. +  char *short_name;
  794. +  int (*proto_reply_fn)(char *);
  795. +  int protocol_level;
  796. +} supported_protocols[] = {
  797. +  {"NT LANMAN 1.0",           "NT1",      reply_nt1,      PROTOCOL_NT1},
  798. +  {"NT LM 0.12",              "NT1",      reply_nt1,      PROTOCOL_NT1},
  799. +  {"LM1.2X002",               "LANMAN2",  reply_lanman2,  PROTOCOL_LANMAN2},
  800. +  {"Samba",                   "LANMAN2",  reply_lanman2,  PROTOCOL_LANMAN2},
  801. +  {"DOS LM1.2X002",           "LANMAN2",  reply_lanman2,  PROTOCOL_LANMAN2},
  802. +  {"LANMAN1.0",               "LANMAN1",  reply_lanman1,  PROTOCOL_LANMAN1},
  803. +  {"MICROSOFT NETWORKS 3.0",  "LANMAN1",  reply_lanman1,  PROTOCOL_LANMAN1},
  804. +  {"MICROSOFT NETWORKS 1.03", "COREPLUS", reply_coreplus, PROTOCOL_COREPLUS},
  805. +  {"PC NETWORK PROGRAM 1.0",  "CORE",     reply_corep,    PROTOCOL_CORE}, 
  806. +  {NULL,NULL},
  807. +};
  808. +
  809. +
  810.  /****************************************************************************
  811.    reply to a negprot
  812.  ****************************************************************************/
  813. @@ -2927,41 +2855,66 @@
  814.    int protocol;
  815.    char *p;
  816.    int bcc = SVAL(smb_buf(inbuf),-2);
  817. -  int arch_known = 0;
  818. +  int arch = ARCH_ALL;
  819.  
  820. -  /* look through the protocol list to determine architecture */
  821. -  Index = 0;
  822.    p = smb_buf(inbuf)+1;
  823.    while (p < (smb_buf(inbuf) + bcc))
  824.      { 
  825. -      DEBUG(3,("protocol [%s]\n",p));
  826. -      if (!arch_known) {
  827. -        if (strcsequal(p,"Samba")) {
  828. -          strcpy(remote_arch,"Samba");
  829. -          arch_known = 1;
  830. -        } else if (strcsequal(p,"NT LM 0.12")) {
  831. -      strcpy(remote_arch,"WinNT");
  832. -        } else if (strcsequal(p,"Windows for Workgroups 3.1a")) {
  833. -          strcpy(remote_arch,"WfWg");
  834. -        }
  835. -        Index++;
  836. +      Index++;
  837. +      DEBUG(1,("Requested protocol [%s]\n",p));
  838. +      if (strcsequal(p,"Windows for Workgroups 3.1a"))
  839. +    arch &= ( ARCH_WFWG | ARCH_WIN95 | ARCH_WINNT );
  840. +      else if (strcsequal(p,"DOS LM1.2X002"))
  841. +    arch &= ( ARCH_WFWG | ARCH_WIN95 );
  842. +      else if (strcsequal(p,"DOS LANMAN2.1"))
  843. +    arch &= ( ARCH_WFWG | ARCH_WIN95 );
  844. +      else if (strcsequal(p,"NT LM 0.12"))
  845. +    arch &= ( ARCH_WIN95 | ARCH_WINNT );
  846. +      else if (strcsequal(p,"LANMAN2.1"))
  847. +    arch &= ( ARCH_WINNT | ARCH_OS2 );
  848. +      else if (strcsequal(p,"LM1.2X002"))
  849. +    arch &= ( ARCH_WINNT | ARCH_OS2 );
  850. +      else if (strcsequal(p,"MICROSOFT NETWORKS 1.03"))
  851. +    arch &= ARCH_WINNT;
  852. +      else if (strcsequal(p,"XENIX CORE"))
  853. +    arch &= ( ARCH_WINNT | ARCH_OS2 );
  854. +      else if (strcsequal(p,"Samba")) {
  855. +    arch = ARCH_SAMBA;
  856. +    break;
  857.        }
  858.        p += strlen(p) + 2;
  859.      }
  860. -
  861. -  DEBUG(4,("Got remote arch %s\n",remote_arch));
  862. -  
  863. +    
  864. +  switch ( arch ) {
  865. +  case ARCH_SAMBA:
  866. +    strcpy(remote_arch,"Samba");
  867. +    break;
  868. +  case ARCH_WFWG:
  869. +    strcpy(remote_arch,"WfWg");
  870. +    break;
  871. +  case ARCH_WIN95:
  872. +    strcpy(remote_arch,"Win95");
  873. +    break;
  874. +  case ARCH_WINNT:
  875. +    strcpy(remote_arch,"WinNT");
  876. +    break;
  877. +  case ARCH_OS2:
  878. +    strcpy(remote_arch,"OS2");
  879. +    break;
  880. +  default:
  881. +    strcpy(remote_arch,"UNKNOWN");
  882. +    break;
  883. +  }
  884.    /* possibly reload - change of architecture */
  885.    reload_services(True);      
  886. -  
  887. +    
  888.    /* a special case to stop password server loops */
  889.    if (Index == 1 && strequal(remote_machine,myhostname) && 
  890.        lp_security()==SEC_SERVER)
  891.      exit_server("Password server loop!");
  892.    
  893. -  /* check the log file size */
  894. -  check_log_size();
  895. -
  896.    /* Check for protocols, most desirable first */
  897.    for (protocol = 0; supported_protocols[protocol].proto_name; protocol++)
  898.      {
  899. @@ -2981,8 +2934,11 @@
  900.    
  901.    SSVAL(outbuf,smb_vwv0,choice);
  902.    if(choice != -1) {
  903. +    extern fstring remote_proto;
  904. +    strcpy(remote_proto,supported_protocols[protocol].short_name);
  905. +    reload_services(True);          
  906.      outsize = supported_protocols[protocol].proto_reply_fn(outbuf);
  907. -    DEBUG(2,("Chose protocol %s\n",supported_protocols[protocol].proto_name));
  908. +    DEBUG(1,("Selected protocol %s\n",supported_protocols[protocol].proto_name));
  909.    }
  910.    else {
  911.      DEBUG(0,("No protocol supported !\n"));
  912. @@ -3340,8 +3296,7 @@
  913.    if (!firsttime) exit(0);
  914.    firsttime = 0;
  915.  
  916. -  if (done_become_user != -1)
  917. -    unbecome_user();
  918. +  unbecome_user();
  919.    DEBUG(1,("Closing connections\n"));
  920.    for (i=0;i<MAX_CONNECTIONS;i++)
  921.      if (Connections[i].open)
  922. @@ -3585,7 +3540,7 @@
  923.        int uid = SVAL(inbuf,smb_uid);
  924.  
  925.        /* does this protocol need to be run as root? */
  926. -      if (!(flags & AS_USER) && (done_become_user != -1))
  927. +      if (!(flags & AS_USER))
  928.          unbecome_user();
  929.  
  930.        /* does this protocol need to be run as the connected user? */
  931. @@ -3814,6 +3769,8 @@
  932.      send_one_packet(OutBuffer,1,ip,137,SOCK_DGRAM);
  933.    }
  934.  #endif    
  935. +
  936. +  last_user.cnum = -1;
  937.    
  938.    while (True)
  939.      {
  940. @@ -3834,8 +3791,7 @@
  941.        {
  942.      extern pstring share_del_pending;
  943.      if (*share_del_pending) {
  944. -      if (done_become_user != -1)
  945. -        unbecome_user();
  946. +      unbecome_user();
  947.        if (!unlink(share_del_pending))
  948.          DEBUG(3,("Share file deleted %s\n",share_del_pending));
  949.        else
  950. @@ -3845,8 +3801,7 @@
  951.        }
  952.  
  953.        if (share_mode_pending) {
  954. -    if (done_become_user != -1)
  955. -      unbecome_user();
  956. +    unbecome_user();
  957.      check_share_modes();
  958.      share_mode_pending=False;
  959.        }
  960. @@ -3871,8 +3826,7 @@
  961.        t = time(NULL);
  962.  
  963.        /* become root again if waiting */
  964. -      if (done_become_user != -1)
  965. -        unbecome_user();
  966. +      unbecome_user();
  967.  
  968.        /* check for smb.conf reload */
  969.        if (!(counter%SMBD_RELOAD_CHECK))
  970. @@ -4016,6 +3970,7 @@
  971.  ****************************************************************************/
  972.  int main(int argc,char *argv[])
  973.  {
  974. +  extern BOOL append_log;
  975.    /* shall I run as a daemon */
  976.    BOOL is_daemon = False;
  977.    int port = 139;
  978. @@ -4031,8 +3986,12 @@
  979.    set_auth_parameters(argc,argv);
  980.  #endif
  981.  
  982. +  append_log = True;
  983. +
  984.    TimeInit();
  985.  
  986. +  strcpy(debugf,SMBLOGFILE);  
  987. +
  988.    setup_logging(argv[0],False);
  989.  
  990.    charset_initialise();
  991. @@ -4048,8 +4007,6 @@
  992.    seteuid(0);
  993.  #endif
  994.  
  995. -  strcpy(debugf,SMBLOGFILE);  
  996. -
  997.    fault_setup(exit_server);
  998.  
  999.    umask(0777 & ~DEF_CREATE_MASK);
  1000. @@ -4100,7 +4057,10 @@
  1001.      strcpy(debugf,optarg);
  1002.      break;
  1003.        case 'a':
  1004. -    append_log = !append_log;
  1005. +    {
  1006. +      extern BOOL append_log;
  1007. +      append_log = !append_log;
  1008. +    }
  1009.      break;
  1010.        case 'D':
  1011.      is_daemon = True;
  1012. diff -u -r --new-file last-version/source/smb.h samba-1.9.15p6/source/smb.h
  1013. --- last-version/source/smb.h    Sun Dec  3 19:23:44 1995
  1014. +++ samba-1.9.15p6/source/smb.h    Mon Dec  4 11:47:31 1995
  1015. @@ -825,7 +825,6 @@
  1016.  void expand_mask(char *Mask, BOOL);
  1017.  BOOL sane_unix_date(time_t unixdate);
  1018.  time_t start_of_month(void);
  1019. -void log_out(char *buffer,int len);
  1020.  char *smb_fn_name(int cnum);
  1021.  void get_machine_info(void);
  1022.  int open_socket_in(int type, int port, int dlevel);
  1023. @@ -833,7 +832,6 @@
  1024.  struct in_addr *interpret_addr2(char *str);
  1025.  BOOL zero_ip(struct in_addr ip);
  1026.  int read_max_udp(int fd,char *buffer,int bufsize,int maxtime);
  1027. -void log_in(char *buffer,int len);
  1028.  int interpret_protocol(char *str,int def);
  1029.  int interpret_security(char *str,int def);
  1030.  int ChDir(char *path);
  1031. @@ -963,7 +961,8 @@
  1032.  enum security_types {SEC_SHARE,SEC_USER,SEC_SERVER};
  1033.  
  1034.  /* printing types */
  1035. -enum printing_types {PRINT_BSD,PRINT_SYSV,PRINT_AIX,PRINT_HPUX};
  1036. +enum printing_types {PRINT_BSD,PRINT_SYSV,PRINT_AIX,PRINT_HPUX,PRINT_QNX};
  1037. +
  1038.  
  1039.  /* case handling */
  1040.  enum case_handling {CASE_LOWER,CASE_UPPER};
  1041. diff -u -r --new-file last-version/source/util.c samba-1.9.15p6/source/util.c
  1042. --- last-version/source/util.c    Sat Dec  2 19:36:08 1995
  1043. +++ samba-1.9.15p6/source/util.c    Tue Dec  5 13:19:19 1995
  1044. @@ -37,8 +37,6 @@
  1045.  
  1046.  /* these are some file handles where debug info will be stored */
  1047.  FILE *dbf = NULL;
  1048. -FILE *login=NULL;
  1049. -FILE *logout=NULL;
  1050.  
  1051.  /* the client file descriptor */
  1052.  int Client = -1;
  1053. @@ -83,6 +81,7 @@
  1054.  fstring remote_machine="";
  1055.  fstring local_machine="";
  1056.  fstring remote_arch="UNKNOWN";
  1057. +fstring remote_proto="UNKNOWN";
  1058.  pstring myhostname="";
  1059.  pstring user_socket_options="";   
  1060.  pstring sesssetup_user="";
  1061. @@ -111,6 +110,46 @@
  1062.    }
  1063.  }
  1064.  
  1065. +
  1066. +BOOL append_log=False;
  1067. +
  1068. +
  1069. +/****************************************************************************
  1070. +reopen the log files
  1071. +****************************************************************************/
  1072. +void reopen_logs(void)
  1073. +{
  1074. +  extern FILE *dbf;
  1075. +  pstring fname;
  1076. +  
  1077. +  if (DEBUGLEVEL > 0)
  1078. +    {
  1079. +      strcpy(fname,debugf);
  1080. +      if (lp_loaded() && (*lp_logfile()))
  1081. +    strcpy(fname,lp_logfile());
  1082. +
  1083. +      if (!strcsequal(fname,debugf) || !dbf || !file_exist(debugf,NULL))
  1084. +    {
  1085. +      strcpy(debugf,fname);
  1086. +      if (dbf) fclose(dbf);
  1087. +      if (append_log)
  1088. +        dbf = fopen(debugf,"a");
  1089. +      else
  1090. +        dbf = fopen(debugf,"w");
  1091. +      if (dbf) setbuf(dbf,NULL);
  1092. +    }
  1093. +    }
  1094. +  else
  1095. +    {
  1096. +      if (dbf)
  1097. +    {
  1098. +      fclose(dbf);
  1099. +      dbf = NULL;
  1100. +    }
  1101. +    }
  1102. +}
  1103. +
  1104. +
  1105.  /*******************************************************************
  1106.  write an debug message on the debugfile. This is called by the DEBUG
  1107.  macro
  1108. @@ -121,7 +160,7 @@
  1109.  #else
  1110.  int Debug1(va_alist)
  1111.  va_dcl
  1112. -{
  1113. +{  
  1114.    char *format_str;
  1115.  #endif
  1116.    va_list ap;  
  1117. @@ -139,50 +178,76 @@
  1118.      return(0);
  1119.    }
  1120.  
  1121. +  {
  1122. +    static int debug_count=0;
  1123. +
  1124. +    debug_count++;
  1125. +    if (debug_count == 100) {
  1126. +      int maxlog = lp_max_log_size() * 1024;
  1127. +      if (dbf && maxlog > 0)
  1128. +    {
  1129. +      struct stat st;
  1130. +
  1131. +      if (fstat(fileno(dbf),&st) == 0 && st.st_size > maxlog) {
  1132. +        fclose(dbf); dbf = NULL;
  1133. +        reopen_logs();
  1134. +        if (dbf && file_size(debugf) > maxlog) {
  1135. +          pstring name;
  1136. +          fclose(dbf); dbf = NULL;
  1137. +          sprintf(name,"%s.old",debugf);
  1138. +          sys_rename(debugf,name);
  1139. +          reopen_logs();
  1140. +        }
  1141. +      }
  1142. +    }
  1143. +      debug_count=0;
  1144. +    }
  1145. +  }
  1146. +  
  1147.  #ifdef SYSLOG
  1148.    if (!lp_syslog_only())
  1149.  #endif  
  1150. -  {
  1151. -    if (!dbf) 
  1152. -      {
  1153. +    {
  1154. +      if (!dbf) 
  1155. +    {
  1156.              dbf = fopen(debugf,"w");
  1157.        if (dbf)
  1158.          setbuf(dbf,NULL);
  1159.        else
  1160.          return(0);
  1161. -      }
  1162. -  }
  1163. +    }
  1164. +    }
  1165.  
  1166.  #ifdef SYSLOG
  1167.    if (syslog_level < lp_syslog())
  1168. -  {
  1169. -    /* 
  1170. -     * map debug levels to syslog() priorities
  1171. -     * note that not all DEBUG(0, ...) calls are
  1172. -     * necessarily errors
  1173. -     */
  1174. -    static int priority_map[] = { 
  1175. -                                  LOG_ERR,     /* 0 */
  1176. -                                  LOG_WARNING, /* 1 */
  1177. -                                  LOG_NOTICE,  /* 2 */
  1178. -                                  LOG_INFO,    /* 3 */
  1179. -                                };
  1180. -    int priority;
  1181. -    pstring msgbuf;
  1182. -
  1183. -    if (syslog_level >= sizeof(priority_map) / sizeof(priority_map[0]) ||
  1184. -        syslog_level < 0)
  1185. -      priority = LOG_DEBUG;
  1186. -    else
  1187. -      priority = priority_map[syslog_level];
  1188. -
  1189. -    vsprintf(msgbuf, format_str, ap);
  1190. -
  1191. -    msgbuf[255] = '\0';
  1192. -    syslog(priority, "%s", msgbuf);
  1193. -  }
  1194. +    {
  1195. +      /* 
  1196. +       * map debug levels to syslog() priorities
  1197. +       * note that not all DEBUG(0, ...) calls are
  1198. +       * necessarily errors
  1199. +       */
  1200. +      static int priority_map[] = { 
  1201. +    LOG_ERR,     /* 0 */
  1202. +    LOG_WARNING, /* 1 */
  1203. +    LOG_NOTICE,  /* 2 */
  1204. +    LOG_INFO,    /* 3 */
  1205. +      };
  1206. +      int priority;
  1207. +      pstring msgbuf;
  1208. +      
  1209. +      if (syslog_level >= sizeof(priority_map) / sizeof(priority_map[0]) ||
  1210. +      syslog_level < 0)
  1211. +    priority = LOG_DEBUG;
  1212. +      else
  1213. +    priority = priority_map[syslog_level];
  1214. +      
  1215. +      vsprintf(msgbuf, format_str, ap);
  1216. +      
  1217. +      msgbuf[255] = '\0';
  1218. +      syslog(priority, "%s", msgbuf);
  1219. +    }
  1220.  #endif
  1221. -
  1222. +  
  1223.  #ifdef SYSLOG
  1224.    if (!lp_syslog_only())
  1225.  #endif
  1226. @@ -190,7 +255,7 @@
  1227.        vfprintf(dbf,format_str,ap);
  1228.        fflush(dbf);
  1229.      }
  1230. -
  1231. +  
  1232.    va_end(ap);
  1233.    return(0);
  1234.  }
  1235. @@ -1950,35 +2015,6 @@
  1236.  }
  1237.  
  1238.  
  1239. -/****************************************************************************
  1240. -log a packet to logout
  1241. -****************************************************************************/
  1242. -void log_out(char *buffer,int len)
  1243. -{
  1244. -  if (DEBUGLEVEL > 100 && logout)
  1245. -    {
  1246. -      fprintf(logout,"\n%s Transaction %d (%d)\n",timestring(),trans_num++,len);
  1247. -      fwrite(buffer,len,1,logout);
  1248. -      fflush(logout);
  1249. -    }      
  1250. -  DEBUG(7,("logged %d bytes out\n",len));
  1251. -}
  1252. -
  1253. -/****************************************************************************
  1254. -log a packet to login
  1255. -****************************************************************************/
  1256. -void log_in(char *buffer,int len)
  1257. -{
  1258. -  if (DEBUGLEVEL > 100 && login)
  1259. -    {
  1260. -      fprintf(login,"\n%s Transaction %d (%d)\n",timestring(),trans_num++,len);
  1261. -      fwrite(buffer,len,1,login);
  1262. -      fflush(login);
  1263. -    }      
  1264. -  DEBUG(7,("logged %d bytes in\n",len));
  1265. -}
  1266. -
  1267. -
  1268.  /*******************************************************************
  1269.  close the low 3 fd's and open dev/null in their place
  1270.  ********************************************************************/
  1271. @@ -2595,7 +2631,6 @@
  1272.        exit(1);
  1273.      }
  1274.  
  1275. -  log_in(buffer,len+4);
  1276.    return(True);
  1277.  }
  1278.  
  1279. @@ -2609,8 +2644,6 @@
  1280.    int ret,nwritten=0;
  1281.    len = smb_len(buffer) + 4;
  1282.  
  1283. -  log_out(buffer,len);
  1284. -
  1285.    while (nwritten < len)
  1286.      {
  1287.        ret = write_socket(fd,buffer+nwritten,len - nwritten);
  1288. @@ -2701,9 +2734,6 @@
  1289.    sock_out.sin_port = htons( port );
  1290.    sock_out.sin_family = AF_INET;
  1291.    
  1292. -  /* log the packet */
  1293. -  log_out(buf,len);
  1294. -
  1295.    if (DEBUGLEVEL > 0)
  1296.      DEBUG(3,("sending a packet of len %d to (%s) on port %d of type %s\n",
  1297.           len,inet_ntoa(ip),port,type==SOCK_DGRAM?"DGRAM":"STREAM"));
  1298. @@ -3858,6 +3888,7 @@
  1299.  {
  1300.    if (!strchr(s,'%')) return;
  1301.  
  1302. +  string_sub(s,"%R",remote_proto);
  1303.    string_sub(s,"%a",remote_arch);
  1304.    string_sub(s,"%m",remote_machine);
  1305.    string_sub(s,"%L",local_machine);
  1306. diff -u -r --new-file last-version/source/version.h samba-1.9.15p6/source/version.h
  1307. --- last-version/source/version.h    Sun Dec  3 22:13:02 1995
  1308. +++ samba-1.9.15p6/source/version.h    Tue Dec  5 16:00:09 1995
  1309. @@ -1 +1 @@
  1310. -#define VERSION "1.9.15p5"
  1311. +#define VERSION "1.9.15p6"
  1312.